<%@page import="java.util.Date"%>
<%@page import="cn.school.servies.*,cn.school.entity.*,java.text.*"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%!
int a;
%>
<%
request.setCharacterEncoding("utf-8");
String sname=request.getParameter("sname");
String sex=request.getParameter("sex");
String telephone=request.getParameter("telephone");
String qq=request.getParameter("qq");
String wechat=request.getParameter("wechat");
long gradeid=Long.parseLong(request.getParameter("gradeid"));
String enterdate=request.getParameter("enterdate");
String fromcity=request.getParameter("fromcity");
String birthday=request.getParameter("birthday");
String address=request.getParameter("address");
String pass=request.getParameter("pass");
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
Date enter=format.parse(enterdate);
Date birth=format.parse(birthday);

Student stu=new Student();
stu.setSname(sname);
stu.setSex(sex);
stu.setTelephone(telephone);
stu.setGradeid(gradeid);
stu.setQq(qq);
stu.setWechat(wechat);
stu.setEnterdate(enter);
stu.setFromcity(fromcity);
stu.setBirthday(birth);
stu.setAddress(address);
stu.setPass(pass);
out.print(stu);
 StudentSerive serive=new StudentSerive();
a=serive.add(stu);  
%>
<%=a %>
</body>
</html>